/* import React,{Component} from "react";
import {View,Text,StyleSheet} from "react-native";
import Button from '../components/Button'
export default class IndexA1 extends Component {
    static navigationOptions = {
        title:"资讯"
    };
    constructor(props){
        super(props);
        console.log("screen IndexA_1->props:",props);
    }

    render(){
        return (
            <View style={{flex:1,justifyContent:"center",alignItems:"center"}}>
                <Text style={{fontSize:20,textAlign:"center",color:"red"}}>
                IndexA_1
                </Text>
                <Button  color="red">跳转到另一个tab</Button>
            </View>
        )
    }

} */


// const mapDispatchToProps = (dispatch, ownProps) => {
//     return {
//         dispatch1: () => {
//             dispatch(actionCreator)
//         }
//     }
// }

// const const mapStateToProps = (state, ownProps) => {
//     return {
//         prop: state.prop
//     }
// }

//export default connect(mapStateToProps, mapDispatchToProps, mergeProps)(component);

import React, { Component } from 'react';
import {
    AppRegistry,
    StyleSheet,
    View,
    Text,
    Image,
    ListView,
    TouchableOpacity,
    Dimensions
}from 'react-native';
var width = Dimensions.get('window').width;
// var height = Dimensions.get('window').height;
export default class IndexA1 extends Component {
    constructor(props) {
        super(props);
        var ds = new ListView.DataSource({rowHasChanged: (r1, r2) => r1 !== r2});
        this.state = {
            dataSource: ds.cloneWithRows([ 
                {
                    "id": "710000201512201032",
                    "thumb": "http://g1.ykimg.com/050C0000595C3945ADC0AEC7BF085F58",
                    "video": "http://www.imooc.com/static/lib/mocoplayer/2.5.1/mocoplayer.swf?v=2.4.3"
                },
                {
                    "id": "540000201705130953",
                    "thumb": "http://g1.ykimg.com/050C0000595C3945ADC0AEC7BF085F58",
                    "video": "http://www.imooc.com/static/lib/mocoplayer/2.5.1/mocoplayer.swf?v=2.4.3"
                },
                {
                    "id": "36000020090726779X",
                    "thumb": "http://g1.ykimg.com/050C0000595C3945ADC0AEC7BF085F58",
                    "video": "http://www.imooc.com/static/lib/mocoplayer/2.5.1/mocoplayer.swf?v=2.4.3"
                },
                {
                    "id": "23000019890819858X",
                    "thumb": "http://g1.ykimg.com/050C0000595C3945ADC0AEC7BF085F58",
                    "video": "http://www.imooc.com/static/lib/mocoplayer/2.5.1/mocoplayer.swf?v=2.4.3"
                },
                {
                    "id": "810000199101084138",
                    "thumb": "http://g1.ykimg.com/050C0000595C3945ADC0AEC7BF085F58",
                    "video": "http://www.imooc.com/static/lib/mocoplayer/2.5.1/mocoplayer.swf?v=2.4.3"
                },
                {
                    "id": "810000198412233773",
                    "thumb": "http://g1.ykimg.com/050C0000595C3945ADC0AEC7BF085F58",
                    "video": "http://www.imooc.com/static/lib/mocoplayer/2.5.1/mocoplayer.swf?v=2.4.3"
                },
                {
                    "id": "610000200610314331",
                    "thumb": "http://g1.ykimg.com/050C0000595C3945ADC0AEC7BF085F58",
                    "video": "http://www.imooc.com/static/lib/mocoplayer/2.5.1/mocoplayer.swf?v=2.4.3"
                },
                {
                    "id": "360000201607162472",
                    "thumb": "http://g1.ykimg.com/050C0000595C3945ADC0AEC7BF085F58",
                    "video": "http://www.imooc.com/static/lib/mocoplayer/2.5.1/mocoplayer.swf?v=2.4.3"
                }
            ]),
        };
    }
    _renderRow(rowData, sectionID, rowID) {

        return (
            <TouchableOpacity>
                <View>
                    <View style={ styles.titleContainer}>
                        <Text style={styles.title}>美女和男神的养成密集，让赵丽颖来告诉你</Text>
                    </View>

                    <View>
                        <Image source={{ uri: rowData.thumb }} style={styles.img}></Image>
                        <Image source={ require('../assets/image/login.png') } style={styles.go}></Image>
                    </View>

                    <View style={styles.bottom}>
                        <View style={styles.bottomBoth}>
                            <Image style={styles.sLogo} source={ require('../assets/image/login.png') }></Image>
                            <Text style={ styles.bottomText}>喜欢</Text>
                        </View>
                        <View style={styles.bottomBoth}>
                            <Image style={styles.sLogo2} source={ require('../assets/image/login.png') }></Image>
                            <Text style={ styles.bottomText}>评论</Text>
                        </View>
                    </View>

                </View>

            </TouchableOpacity>
        );
    }

    render() {
        return (
            <View style={styles.content}>
                <ListView
                    dataSource={this.state.dataSource}
                    renderRow={ this._renderRow }
                />

            </View>
        )
    }
}


const styles = StyleSheet.create({
    content: {
        flex:1,
        // justifyContent: 'center',
        // alignItems: 'center'
    },
    img: {
        width: width,
        height: 300
    },
    go: {
        position: 'absolute',
        width: 50,
        height: 50,
        bottom: 30,
        right:60
    },
    title: {
        fontSize: 20,
        letterSpacing: 18
    },
    titleContainer: {
        height:46,
        marginTop:14
    },
    bottom: {
        height:60,
        paddingBottom:84,
        flexDirection: 'row',
        justifyContent: 'space-between',
        backgroundColor:"#eee"
    },
    bottomBoth: {
        flexDirection: 'row',
        justifyContent: 'center',
        width: width / 2 - 0.5,
        backgroundColor:"white",
        height:70,
        paddingTop: 4,
        alignItems: 'center'
    },
    sLogo: {
        width: 38,
        height:38,
        marginRight: 8
    },
    sLogo2: {
        width: 42,
        height:44,
        marginRight: 8
    },
    bottomText: {
        fontSize: 20
    }
});